import os

def dmChk():
    p = os.path.join(os.path.dirname(__file__),'Tools','dmchk.ps1').split('\\')
    rp = ''
    for i in range(len(p)):
        rp = rp+p[i]
        if i != len(p)-1:
            rp = rp+r'\\'

    a = os.popen('powershell -file '+rp)
    b = a.read()
    if b == '':
        print('no error in DM')
        return
    else:
        # 数据清洗
        b = b.replace('\n',',').replace('"','').strip(',').split(',')
        while 'Error' in b:
            b.remove('Error')

        print(b)

dmChk()